package com.ganbo.stock.repository;

import com.ganbo.stock.entity.Company;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;


@Repository
public interface CompanyRepository extends JpaRepository<Company, Long> {

    Company findByDm(String dm);

    Company findByName(String name);

    @Query("SELECT o FROM Company o ORDER BY o.version ASC ")
    Page<Company> findMinVersion(PageRequest pageRequest);
    
}
